import 'package:flutter/material.dart';

import '../../../data/db/models/bt_order.dart';
import '../../../utils/bt_tool_utils.dart';
import '../models/bt_my_ticket_model.dart';

class BtOrderItemWidget extends StatelessWidget {
  const BtOrderItemWidget({super.key, required this.index, required this.item, required this.model});

  final int index;

  final BtOrder item;

  final BtMyTicketModel model;

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Container(
          padding: const EdgeInsets.only(left: 16, top: 12, bottom: 16, right: 15),
          decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(
              width: 0.5,
              color: const Color(0xFFEEEEEE),
            ),
            borderRadius: BorderRadius.circular(10),
            boxShadow: const [
              BoxShadow(
                color: Color(0x30000000), // 阴影颜色
                spreadRadius: 0, // 阴影扩散程度
                blurRadius: 2, // 阴影模糊程度
                offset: Offset(0, 2), // 阴影偏移量
              ),
            ],
          ),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  const Text('Order Notifications',
                      style:
                          TextStyle(fontSize: 16, color: Color(0xFF404040), fontWeight: FontWeight.normal)),
                  Padding(
                    padding: const EdgeInsets.only(top: 9),
                    child: Text(item.orderNo,
                        style: const TextStyle(
                            fontSize: 12, color: Color(0xFF3F8ACF), fontWeight: FontWeight.normal)),
                  )
                ],
              ),
              InkWell(
                child: Container(
                  width: 62,
                  height: 26,
                  padding: const EdgeInsets.only(top: 2),
                  decoration: BoxDecoration(
                    color: const Color(0xFF1F1F1F),
                    borderRadius: BorderRadius.circular(50),
                  ),
                  child: const Text('Copy',
                      textAlign: TextAlign.center,
                      style: TextStyle(fontSize: 14, color: Color(0xFFFFFFFF), fontWeight: FontWeight.bold)),
                ),
                onTap: () async {
                  await copyTextToClipboard(item.orderNo);
                },
              )
            ],
          ),
        ),
        Visibility(
          visible: true,
          child: Positioned(
            top: 0,
            right: 0,
            child: Container(
              width: 65,
              height: 14,
              decoration: BoxDecoration(
                color: const Color(0xFFEFFEFF),
                borderRadius: BorderRadius.circular(2),
              ),
              child: const Text('to be used',
                  textAlign: TextAlign.center,
                  style: TextStyle(fontSize: 10, color: Color(0xFF3F5FCF), fontWeight: FontWeight.normal)),
            ),
          ),
        ),
      ],
    );
  }
}
